package design_pattern.proxy.dynamicProxy;




public class DataCollector implements Collecter{
    private String doBefore(){
	return "start collecting data...";
    }
    
    private String doAfter(){
	return "the collecting process finished!";
    }
    
    public void collect() throws InterruptedException{
	System.out.println(doBefore());
	Thread.sleep((long)(Math.random()*4000));
	System.out.println(doAfter());
    }
    
    public String outputData(String arg){
	StringBuffer buffer= new StringBuffer().append(doBefore()).append("\n").append(arg).append("\n").append(doAfter()) ;
	return buffer.toString();
    }

}
